package org.dtrd.modules.record.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.EqualsAndHashCode;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.bean.SportBean;

import javax.persistence.*;
import java.text.ParseException;
import java.util.Date;

@Table(name = "dtrd_ent_rd_signin_sport_record")
@EqualsAndHashCode
public class DtrdEntRdSigninSportRecord {
    @Id
    @Column(name = "data_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Integer dataId;

    @Column(name = "patient_id")
    private Integer patientId;

    /**
     * 记录日期
     */
    @Column(name = "record_date")
    private Date recordDate;

    /**
     * 记录时间
     */
    @Column(name = "record_time")
    private Date recordTime;

    /**
     * 运动步数
     */
    @Column(name = "sport_record_step")
    private Integer sportRecordStep;

    /**
     * 1-快走,2-慢走
     */
    @Column(name = "sport_record_steptype")
    private Integer sportRecordSteptype;

    /**
     * 力量运动描述
     */
    @Column(name = "sport_record_power_describe")
    private String sportRecordPowerDescribe;

    /**
     * 运动备注
     */
    @Column(name = "sport_record_remark")
    private String sportRecordRemark;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "is_del")
    private Integer isDel;

    /**
     * 照片以 竖线 | 拼接
     */
    @Column(name = "record_photo")
    private String recordPhoto;

    /**
     * 档案标记1-建档,0-日常监测
     */
    private Integer sportRecordArchiveTag;

    /**
     * @return data_id
     */
    public Integer getDataId() {
        return dataId;
    }

    /**
     * @param dataId
     */
    public void setDataId(Integer dataId) {
        this.dataId = dataId;
    }

    /**
     * @return patient_id
     */
    public Integer getPatientId() {
        return patientId;
    }

    /**
     * @param patientId
     */
    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }

    /**
     * 获取记录日期
     *
     * @return record_date - 记录日期
     */
    public Date getRecordDate() {
        return recordDate;
    }

    /**
     * 设置记录日期
     *
     * @param recordDate 记录日期
     */
    public void setRecordDate(Date recordDate) {
        this.recordDate = recordDate;
    }

    /**
     * 获取记录时间
     *
     * @return record_time - 记录时间
     */
    public Date getRecordTime() {
        return recordTime;
    }

    /**
     * 设置记录时间
     *
     * @param recordTime 记录时间
     */
    public void setRecordTime(Date recordTime) {
        this.recordTime = recordTime;
    }

    /**
     * 获取运动步数
     *
     * @return sport_record_step - 运动步数
     */
    public Integer getSportRecordStep() {
        return sportRecordStep;
    }

    /**
     * 设置运动步数
     *
     * @param sportRecordStep 运动步数
     */
    public void setSportRecordStep(Integer sportRecordStep) {
        this.sportRecordStep = sportRecordStep;
    }

    /**
     * 获取1-快走,2-慢走
     *
     * @return sport_record_steptype - 1-快走,2-慢走
     */
    public Integer getSportRecordSteptype() {
        return sportRecordSteptype;
    }

    /**
     * 设置1-快走,2-慢走
     *
     * @param sportRecordSteptype 1-快走,2-慢走
     */
    public void setSportRecordSteptype(Integer sportRecordSteptype) {
        this.sportRecordSteptype = sportRecordSteptype;
    }

    /**
     * 获取力量运动描述
     *
     * @return sport_record_power_describe - 力量运动描述
     */
    public String getSportRecordPowerDescribe() {
        return sportRecordPowerDescribe;
    }

    /**
     * 设置力量运动描述
     *
     * @param sportRecordPowerDescribe 力量运动描述
     */
    public void setSportRecordPowerDescribe(String sportRecordPowerDescribe) {
        this.sportRecordPowerDescribe = sportRecordPowerDescribe;
    }

    /**
     * 获取运动备注
     *
     * @return sport_record_remark - 运动备注
     */
    public String getSportRecordRemark() {
        return sportRecordRemark;
    }

    /**
     * 设置运动备注
     *
     * @param sportRecordRemark 运动备注
     */
    public void setSportRecordRemark(String sportRecordRemark) {
        this.sportRecordRemark = sportRecordRemark;
    }

    /**
     * @return create_time
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @param createTime
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @return is_del
     */
    public Integer getIsDel() {
        return isDel;
    }

    /**
     * @param isDel
     */
    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }

    /**
     * 获取照片以 竖线 | 拼接
     *
     * @return record_photo - 照片以 竖线 | 拼接
     */
    public String getRecordPhoto() {
        return recordPhoto;
    }

    /**
     * 设置照片以 竖线 | 拼接
     *
     * @param recordPhoto 照片以 竖线 | 拼接
     */
    public void setRecordPhoto(String recordPhoto) {
        this.recordPhoto = recordPhoto;
    }

    public Integer getSportRecordArchiveTag() {
        return sportRecordArchiveTag;
    }

    public void setSportRecordArchiveTag(Integer sportRecordArchiveTag) {
        this.sportRecordArchiveTag = sportRecordArchiveTag;
    }

    public DtrdEntRdSigninSportRecord parseFromDTO(SportBean dto){
        dataId = dto.getDataId();
        patientId = dto.getPatientId();
        if (dto.getRecordTime() != null) {
            try {
                recordDate = DateUtils.parseDate(dto.getRecordTime(), DateUtils.date_sdf.get().toPattern());
                recordTime = DateUtils.parseDate(dto.getRecordTime(), DateUtils.datetimeFormat.get().toPattern());
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        recordPhoto = dto.getRecordPhoto();
        sportRecordStep = dto.getSportRecordStep();
        sportRecordSteptype = dto.getSportRecordSteptype();
        sportRecordPowerDescribe = dto.getSportRecordPowerDescribe();
        sportRecordRemark = dto.getSportRecordRemark();
        return this;
    }

    public DtrdEntRdSigninSportRecord init() {
        isDel = 0;
        createTime = new Date();
        return this;
    }
}